package com.asl.website.legalDocuments.domain;

import com.asl.common.utils.StringUtils;
import com.asl.website.common.Language;

/**
 * 法律文档标题DTO（仅包含标题和ID）
 */
public class LegalDocumentTitleDTO {
    private Long id;
    private String title;
    private String language;

    public LegalDocumentTitleDTO(LegalDocuments doc, String language) {
        this.id = doc.getId();
        this.language = language;

        switch (Language.fromCode(language)) {
            case EN_US:
                this.title = StringUtils.firstNonBlank(doc.getTitleEn(), doc.getTitleZh());
                break;
            case DE_DE:
                this.title = StringUtils.firstNonBlank(doc.getTitleDe(), doc.getTitleZh());
                break;
            default: // 默认中文
                this.title = doc.getTitleZh();
        }
    }

    // Getters
    public Long getId() {
        return id;
    }

    public String getTitle() {
        return title;
    }

    public String getLanguage() {
        return language;
    }
}